#include <stdio.h>
#include <rtthread.h>


#pragma import(__use_no_semihosting)

struct __FILE
{
  int handle;

  /* Whatever you require here. If the only file you are using is */
  /* standard output using printf() for debugging, no file handling */
  /* is required. */
};

FILE __stdout;
FILE __stdin;
FILE __stderr;

int fputc(int ch, FILE *f)
{
    //while(1);
	rt_device_t console_dev = rt_device_find("uart0");
	if (console_dev != RT_NULL)
		rt_device_write(console_dev, 0, &ch, 1);
	
	return 0;
//    return ch;
}

int fgetc(FILE *f)
{
    while(1);
//    return 0;
}

int ferror(FILE *f)                              // Your implementation of ferror
{
    while(1);
	
//    return EOF;
}

int sendchar (int ch)
{
    return 0;
}

int getkey (void)
{
    return 0;
}

int _sys_open(const char *name,int return_code)
{
label:
    goto label; // endless loop
}

void _sys_exit(int return_code)
{
label:
    goto label; // endless loop
}

void _ttywrch(int ch)   // Not used (No Output)
{
}

